package com.ruoyi.pcwl.controller;

import java.util.List;


import com.ruoyi.pcwl.domain.PcwlShop;
import com.ruoyi.pcwl.domain.query.PcwlShopQuery;
import com.ruoyi.pcwl.domain.vo.Result;
import com.ruoyi.pcwl.service.PcwlShopService;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;

/**
 * 商铺信息 Controller
 */

@Api(tags = "商铺信息控制层")
@RestController("pcwlShopController")
@RequestMapping("/pcwlShop")
public class PcwlShopController extends BaseController{

	@Resource
	private PcwlShopService pcwlShopService;



	/**
	 * 根据Id查询对象
	 */
	@ApiOperation("根据Id查询对象")
	@GetMapping("/getPcwlShopById/{id}")
	public Result getPcwlShopById(@PathVariable Long id) {
		return Result.ok(pcwlShopService.getPcwlShopById(id));
	}


	/**
	 * 新增商铺
	 */
	@ApiOperation("新增商铺")
	@PostMapping("/addShop")
	public Result addShop(PcwlShop bean) {
		pcwlShopService.add(bean);
		return Result.ok(null);
	}


	/**
	 * 根据条件分页查询
	 */
	@ApiOperation("根据条件分页查询")
	@GetMapping("/loadDataList")
	public Result loadDataList(PcwlShopQuery query){
		return Result.ok(pcwlShopService.selectPage(query));
	}

	/**
	 * 新增
	 */
	@ApiOperation("新增")
	@PostMapping("/add")
	public Result add(@RequestBody PcwlShop bean) {
		pcwlShopService.add(bean);
		return Result.ok(null);
	}

	/**
	 * 批量新增
	 */
	@ApiOperation("批量新增")
	@PostMapping("/addBatch")
	public Result addBatch(@RequestBody List<PcwlShop> listBean) {
		pcwlShopService.addBatch(listBean);
		return Result.ok(null);
	}

	/**
	 * 批量新增/修改
	 */
	@ApiOperation("批量新增/修改")
	@PostMapping("/addOrUpdateBatch")
	public Result addOrUpdateBatch(@RequestBody List<PcwlShop> listBean) {
		pcwlShopService.addBatch(listBean);
		return Result.ok(null);
	}



//	/**
//	 * 根据Id查询对象
//	 */
//	@ApiOperation("根据Id查询对象")
//	@GetMapping("/getPcwlShopById/{id}")
//	public Result getPcwlShopById(@PathVariable Long id) {
//		return Result.ok(pcwlShopService.getPcwlShopById(id));
//	}

	/**
	 * 根据Id修改对象
	 */
	@ApiOperation("根据Id修改对象")
	@PutMapping("/updatePcwlShopById/{id}")
	public Result updatePcwlShopById(@RequestBody PcwlShop bean,@PathVariable Long id) {
		pcwlShopService.updatePcwlShopById(bean);
		return Result.ok(null);
	}

	/**
	 * 根据Id删除
	 */

	@ApiOperation("根据Id删除")
	@DeleteMapping("/deletePcwlShopById/{id}")
	public Result deletePcwlShopById(@PathVariable Long id) {
		pcwlShopService.deletePcwlShopById(id);
		return Result.ok(null);
	}
}
